package cn.ly.security.controller;

import cn.ly.security.service.DataSourceDetailService;
import com.lowagie.text.DocumentException;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.FileNotFoundException;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/printData")
@Api(tags="查看数据库表（暂时废弃）")
@CrossOrigin("*")
public class DataSourceDetaiController {
    @Autowired
    private DataSourceDetailService dataSourceDetailService;

@GetMapping("/printDataall")
    public void test1(){
        List<Map<String,Object>> list = this.dataSourceDetailService.getAllDataSourceName("security");
        try {
            this.dataSourceDetailService.toWord(list);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (DocumentException e) {
            e.printStackTrace();
        }
    }
}
